package com.iknow.activity;

import android.content.Intent;
import android.os.AsyncTask.Status;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.widget.Button;
import com.iknow.IKnow;
import com.iknow.User;
import com.iknow.data.QingBo;
import com.iknow.data.SubscribeTag;
import com.iknow.db.IKnowDataBase;
import com.iknow.task.CommonTask.QingboTask;
import com.iknow.task.TaskParams;
import java.util.Iterator;
import java.util.List;

public class SubscribeFlagQingboActivity extends QingboWithNoHeaderActivity
{
  private MenuItem.OnMenuItemClickListener AboutClickListener;
  private MenuItem.OnMenuItemClickListener ExitClickListener;
  private MenuItem.OnMenuItemClickListener FeedbackClickListener;
  private MenuItem.OnMenuItemClickListener ManagerTagClickListener;
  private String TAG = "FlagQingboActivity";
  private String mTags;
  User mUser;

  public SubscribeFlagQingboActivity()
  {
    this.ManagerTagClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        Intent localIntent = new Intent(this.this$0, FlagActivity.class);
        this.this$0.startActivity(localIntent);
        return false;
      }
    };
    this.FeedbackClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        return false;
      }
    };
    this.AboutClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        return false;
      }
    };
    this.ExitClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        return false;
      }
    };
  }

  List<QingBo> doGetLocolData()
  {
    return IKnow.mIKnowDataBase.getAllSubscribeQingboList();
  }

  void doNeedMore()
  {
    if ((this.mTask != null) && (this.mTask.getStatus() == AsyncTask.Status.RUNNING));
    while (true)
    {
      return;
      this.mGetMoreButton.setText("正在载入数据...");
      this.mTask = new CommonTask.QingboTask();
      this.mTask.setListener(this.mGetMoreListener);
      this.mTask.setAdapter(this.mAdapter);
      TaskParams localTaskParams = new TaskParams();
      localTaskParams.put("tags", this.mTags);
      localTaskParams.put("offset", Integer.valueOf(0));
      localTaskParams.put("length", Integer.valueOf(20));
      CommonTask.QingboTask localQingboTask = this.mTask;
      TaskParams[] arrayOfTaskParams = new TaskParams[1];
      arrayOfTaskParams[0] = localTaskParams;
      localQingboTask.execute(arrayOfTaskParams);
    }
  }

  void getServerData()
  {
    if ((this.mTask != null) && (this.mTask.getStatus() == AsyncTask.Status.RUNNING));
    while (true)
    {
      return;
      this.mTask = new CommonTask.QingboTask();
      this.mTask.setListener(this.mTaskListener);
      this.mTask.setAdapter(this.mAdapter);
      TaskParams localTaskParams = new TaskParams();
      localTaskParams.put("tags", this.mTags);
      localTaskParams.put("offset", Integer.valueOf(0));
      localTaskParams.put("length", Integer.valueOf(20));
      localTaskParams.put("page_type", Integer.valueOf(3));
      CommonTask.QingboTask localQingboTask = this.mTask;
      TaskParams[] arrayOfTaskParams = new TaskParams[1];
      arrayOfTaskParams[0] = localTaskParams;
      localQingboTask.execute(arrayOfTaskParams);
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.PAGE_TYPE = 3;
    this.TAG = "FollowActivity";
    this.mUser = IKnow.mIKnowDataBase.getUser();
    List localList = IKnow.mIKnowDataBase.getSubscribeTags(this.mUser.getUID());
    StringBuilder localStringBuilder = new StringBuilder();
    Iterator localIterator = localList.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        localStringBuilder.deleteCharAt(localStringBuilder.length() - 1);
        this.mTags = localStringBuilder.toString();
        getLocolData();
        return;
      }
      localStringBuilder.append(((SubscribeTag)localIterator.next()).getTagName()).append(",");
    }
  }

  void refreshData()
  {
  }
}